package DataStructure;

import java.io.PrintWriter;
import java.util.Scanner;

class Node
{	public int lb,ub,power;
	public Node left,right;
	public Node(int l,int u)
	{	lb=l;ub=u;power=0;
		left=null;right=null;
	}
	public boolean isLeaf()
	{	if (left==null && right==null)
			return true;
		else
			return false;
	}
}
class Solver1090
{	int row,n,max,rs;
	int[][] Rec;
	Node Tree;

	public void Input()
	{	Scanner in=new Scanner(System.in);
		n=in.nextInt();
		row=in.nextInt();
		Rec=new int[row+1][n+1];
		for (int i=1;i<=row;i++)
			for (int j=1;j<=n;j++)
				Rec[i][j]=in.nextInt();
		max=-1;
		rs=-1;
	}
	private void BuildTree(Node node)
	{	if (node.lb<node.ub)
		{	int mid=(node.lb+node.ub)/2;
			node.left=new Node(node.lb,mid);
			node.right=new Node(mid+1,node.ub);
			BuildTree(node.left);
			BuildTree(node.right);
		}
	}
	private void EmptyTree(Node node)
	{	node.power=0;
		if (node.left!=null) EmptyTree(node.left);
		if (node.right!=null) EmptyTree(node.right);
	}
	private int CalRow(int index)
	{	int count=0,max=0,i;
		Node node;
		for (i=1;i<=n;i++)
		{	node=Tree;
			while (node!=null)
			{	node.power++;
				int mid=(node.ub+node.lb)/2;
				if (node.isLeaf())
					node=null;
				else
				{	if (Rec[index][i]<=mid)
					{	count+=node.right.power;
						node=node.left;
					}
					else
						node=node.right;
				}
			}
			if (count>max) max=count;
		}
		return max;
	}
	public void Solve()
	{	Tree=new Node(1,n);
		BuildTree(Tree);
		for (int i=1;i<=row;i++)
		{	int tmp=CalRow(i);
			if (tmp>max)
			{	max=tmp;
				rs=i;
			}
			EmptyTree(Tree);
		}
	}
	public void Output()
	{	PrintWriter out=new PrintWriter(System.out);
		out.println(rs);
		out.flush();
	}
	public void main()
	{	Input();
		Solve();
		Output();
	}
}
public class P1090
{	public static void main(String[] args)
	{	Solver1090 solver=new Solver1090();
		solver.main();
	}
}
